/******************************************************************************\
*  Animeshell 1.0 Multimedia manager                                           *
*  Copyright (C) 2006-2007 Rémy Guillemette <shaikadzari@gmail.com>            *
*                                                                              *
*  This program is free software; you can redistribute it and/or modify        *
*  it under the terms of the GNU General Public License version 2 only as      *
*  published by the Free Software Foundation.                                  *
*                                                                              *
*  This program is distributed in the hope that it will be useful,             *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of              *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
*  GNU General Public License for more details.                                *
*                                                                              *
*  You should have received a copy of the GNU General Public License           *
*  along with this program; if not, write to the                               *
*  Free Software Foundation, Inc.,                                             *
*  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                   *
\******************************************************************************/
#ifndef SQLCLASSBASE_H
#define SQLCLASSBASE_H

#include <QSqlDatabase>
#include <QVariant>
#include <QString>
//
#include "animeclass.h"
//


/*! 
    \class sqlclassbase
    \brief A simple class to open and close database.

    You can only open and close connection to a database with this class.
    Use the contructor to specify the driver, the name of the database, 
    the user who open it and his password.
    
    \author Rémy Guillemette <rguillemette@b2b2c.ca>
    \version 1.0.1
*/
class sqlclassbase  
{

public:

	/*! sqlclassbase(QString pDriver, QString pDatabase, QString pUser, QString pPasswd)
	    \brief sqlclassbase contructor
	    \param[in] pDriver Database driver to use
	    \param[in] pDatabase Databse to open
	    \param[in] pUser User login to use
   		\param[in] pPasswd User password to use
	*/
	sqlclassbase(QString pDriver, QString pDatabase, QString pUser, QString pPasswd);
	
	
	/*! OpenDatabase()
	    \brief Open the database
	    \return True if database is opened sucessfully
	*/
	virtual bool OpenDatabase();
	
	
	/*! CloseDatabase()
	    \brief Close the database
	*/
	virtual bool CloseDatabase();
	
	
	/*! LookForTable( QString pTableName )
		\brief Look if table pTableName exists in database
		\param[in] pTableName The name of the table
		\return Number of line in table
	*/
	virtual int LookForTable( QString pTableName ); 

private:
	QString m_Driver;
	QString m_Database;
	QString m_User;
	QString m_Passwd;
	
protected:
	QSqlDatabase db;
};
#endif
